package com.qf.dao;

import com.qf.pojo.TbUser;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/8/23 11:08
 */
public interface UserMapper {
    TbUser selectTbUser(Long id);
    List<TbUser> selectAll();
    TbUser selectUserName(@Param("name") String username, @Param("pwd") String password);

    @SelectKey(keyColumn = "id",keyProperty="id",before =false, resultType =long.class, statement = " select last_insert_id()")
    @Insert("        insert into tb_user (username,password,email,gender)\n" +
            "        value (#{username},#{password},#{email},#{gender})")
    void add(TbUser tbUser);

    TbUser selectMap( Map map);

    TbUser selectMapAs(@Param("map") Map map);

    @Select("select * from tb_user where username like concat(\"%\",#{username},\"%\")\n")
    List<TbUser> selectLike(String username);

    @Delete("delete from tb_user where id=#{did}")
    int delete(@Param("did") Long id);

    void updateUser(Map map);

}
